From 97462408aa80c0ea223cce5e67c9e06208f4aebe Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Sun, 13 Feb 2022 13:05:56 -0700 Subject: [PATCH] eliminate unnecessary string conversions. toString().to* is suspicious, QStringRef and QStringView probably can be converted directly to *. --- geo.cc | 4 ++-- ik3d.cc | 4 ++-- mapfactor.cc | 4 ++-- osm.cc | 8 ++++---- tef_xml.cc | 4 ++-- xol.cc | 8 ++++---- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/geo.cc b/geo.cc index bd84344e2..cb4b64067 100644 --- a/geo.cc +++ b/geo.cc @@ -64,8 +64,8 @@ static void GeoReadLoc() wpt->description = reader.readElementText(); } else if (current_tag == u"/loc/waypoint/coord") { QXmlStreamAttributes a = reader.attributes(); - wpt->latitude = a.value("lat").toString().toDouble(); - wpt->longitude = a.value("lon").toString().toDouble(); + wpt->latitude = a.value("lat").toDouble(); + wpt->longitude = a.value("lon").toDouble(); } else if (current_tag == u"/loc/waypoint/type") { wpt->icon_descr = reader.readElementText(); } else if (current_tag == u"/loc/waypoint/link") { diff --git a/ik3d.cc b/ik3d.cc index ea2991947..12192f4e7 100644 --- a/ik3d.cc +++ b/ik3d.cc @@ -74,10 +74,10 @@ static void iktobj_waypt(xg_string, const QXmlStreamAttributes* attrv) { if (attrv->hasAttribute("X")) { - waypt->longitude = attrv->value("X").toString().toDouble(); + waypt->longitude = attrv->value("X").toDouble(); } if (attrv->hasAttribute("Y")) { - waypt->latitude = attrv->value("Y").toString().toDouble(); + waypt->latitude = attrv->value("Y").toDouble(); } } diff --git a/mapfactor.cc b/mapfactor.cc index 28710d0c2..83b6d612f 100644 --- a/mapfactor.cc +++ b/mapfactor.cc @@ -45,8 +45,8 @@ void MapfactorFormat::MapfactorRead() QXmlStreamAttributes a = reader.attributes(); wpt->shortname = a.value("name").toString(); - wpt->latitude = a.value("lat").toString().toDouble() / milliarcseconds; - wpt->longitude = a.value("lon").toString().toDouble() / milliarcseconds; + wpt->latitude = a.value("lat").toDouble() / milliarcseconds; + wpt->longitude = a.value("lon").toDouble() / milliarcseconds; } } diff --git a/osm.cc b/osm.cc index a34c5b9b2..8929aa6c9 100644 --- a/osm.cc +++ b/osm.cc @@ -454,10 +454,10 @@ OsmFormat::osm_node(xg_string /*unused*/, const QXmlStreamAttributes* attrv) // if (attrv->hasAttribute("user")) ; // ignored if (attrv->hasAttribute("lat")) { - wpt->latitude = attrv->value("lat").toString().toDouble(); + wpt->latitude = attrv->value("lat").toDouble(); } if (attrv->hasAttribute("lon")) { - wpt->longitude = attrv->value("lon").toString().toDouble(); + wpt->longitude = attrv->value("lon").toDouble(); } if (attrv->hasAttribute("timestamp")) { @@ -589,10 +589,10 @@ OsmFormat::osm_way_center(xg_string /*unused*/, const QXmlStreamAttributes* attr wpt->wpt_flags.fmt_use = 1; if (attrv->hasAttribute("lat")) { - wpt->latitude = attrv->value("lat").toString().toDouble(); + wpt->latitude = attrv->value("lat").toDouble(); } if (attrv->hasAttribute("lon")) { - wpt->longitude = attrv->value("lon").toString().toDouble(); + wpt->longitude = attrv->value("lon").toDouble(); } } diff --git a/tef_xml.cc b/tef_xml.cc index 77004f075..475969750 100644 --- a/tef_xml.cc +++ b/tef_xml.cc @@ -54,7 +54,7 @@ TefXMLFormat::tef_start(xg_string /*unused*/, const QXmlStreamAttributes* attrv) valid = true; } } else if (attr.name().compare(QLatin1String("Version"), Qt::CaseInsensitive) == 0) { - version = attr.value().toString().toDouble(); + version = attr.value().toDouble(); } } @@ -85,7 +85,7 @@ void TefXMLFormat::tef_list_start(xg_string /*unused*/, const QXmlStreamAttributes* attrv) { if (attrv->hasAttribute("ItemCount")) { - item_count = attrv->value("ItemCount").toString().toUInt(); + item_count = attrv->value("ItemCount").toUInt(); } } diff --git a/xol.cc b/xol.cc index b5cd7ea40..05aafa7e7 100644 --- a/xol.cc +++ b/xol.cc @@ -87,12 +87,12 @@ static void xol_shape(xg_string, const QXmlStreamAttributes* attrv) { } if (attrv->hasAttribute("alt")) { - wpt_->altitude = attrv->value("alt").toString().toDouble(); + wpt_->altitude = attrv->value("alt").toDouble(); } if (attrv->hasAttribute("timestamp")) { wpt_->creation_time = xml_parse_time( - attrv->value("timestamp").toString().toUtf8().constData()); + attrv->value("timestamp").toString()); } if (attrv->hasAttribute("icon")) { @@ -121,11 +121,11 @@ static void xol_waypt(xg_string, const QXmlStreamAttributes* attrv) { int x = 0, y = 0; if (attrv->hasAttribute("y")) { - y = attrv->value("y").toString().toInt(); + y = attrv->value("y").toInt(); } if (attrv->hasAttribute("x")) { - x = attrv->value("x").toString().toInt(); + x = attrv->value("x").toInt(); } GPS_Math_Swiss_EN_To_WGS84(x, y, &wpt_->latitude, &wpt_->longitude); -- 2.30.2